package com.trade.module.frontEndServer;


import com.trade.module.database.basic.ConstConfig;
import com.trade.module.database.meta.ColumnMetaData;
import com.trade.module.database.meta.TableCloumnParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import net.sf.json.JSONObject;

import java.util.List;
import java.util.Map;

/**
 * Description:前置机采集数据库vo
 * @JDK Version:1.8.0_40
 * Version: V1.0
 * Author: xlz
 * Date: 2016/3/30 10:24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class FrontEndDBVo extends FrontEndVo{
    private static final long serialVersionUID = -7355303184386240458L;
    @NonNull
    ConstConfig.DBType dbType;	//数据库类型
    @NonNull
    String dbUrl;	//数据库地址
    @NonNull
    String dbPort;	//数据库端口
    @NonNull
    String dbUserName;//数据库用户名
    String dbPassword;//数据库密码
    @NonNull
    String dataBaseName;//数据库名
    String dataTables;//数据表名

    String tableName;
    long currentPage;

    String resId;   //源资源ID

    /**
     * 请求类型
     * ConstConfig.DBReqType.REQ_TABLE_CLOUMN：获取字段
     * ConstConfig.DBReqType.REQ_TABLE_DATA：获取表数据
     */
    String reqType;

    /**
     * 表需要查询的列参数，value为字段名，多个字段用逗号分隔
     */
    Map<String,String> queryTableCloumnParamMap;

    /**
     * 表所对应的列数据
     */
    Map<String,List<ColumnMetaData>> columnMetaDataMap;

    /**
     * 表所对应的列参数
     */
    Map<String,TableCloumnParam> tableCloumnParamMap;

    Map<String, List<JSONObject>> exportData;

    String authorizedUser;


    String taskId;//任务ID

    @Override
    public String toString() {
        return "FrontEndDBVo{" +
                "dbType=" + dbType +
                ", dbUrl='" + dbUrl + '\'' +
                ", dbPort='" + dbPort + '\'' +
                ", dbUserName='" + dbUserName + '\'' +
                ", dbPassword='" + dbPassword + '\'' +
                ", dataBaseName='" + dataBaseName + '\'' +
                ", dataTables='" + dataTables + '\'' +
                ", tableName='" + tableName + '\'' +
                ", currentPage=" + currentPage +
                ", resId='" + resId + '\'' +
                ", reqType='" + reqType + '\'' +
                ", queryTableCloumnParamMap=" + queryTableCloumnParamMap +
                ", columnMetaDataMap=" + columnMetaDataMap +
                ", tableCloumnParamMap=" + tableCloumnParamMap +
                ", exportData=" + exportData +
                ", authorizedUser='" + authorizedUser + '\'' +
                ", taskId='" + taskId + '\'' +
                '}';
    }
}
